package sort.cmp;

import java.util.Arrays;

public class 冒泡排序 {


        public static int[] bubbleSort(int[] arr){

            for(int i = arr.length -1; i>0; i--) {
                for (int begin = 1; begin <= i; begin++) {
                    if (arr[begin] < arr[begin - 1]){
                        int tmp = arr[begin - 1];
                        arr[begin - 1] = arr[begin];
                        arr[begin] = tmp;
                    }
                }
            }
            return arr;
        }

    public static void main(String[] args) {
            int[] arr = new int[]{19,14,5,7,8,1};
        int[] ints = bubbleSort(arr);
    }

}
